#include <wx/wx.h>

class ButtonFrame : public wxFrame
{
public:
    ButtonFrame(const wxString& title);

private:
    void OnButtonClick(wxCommandEvent& event);
    void onClose(wxCommandEvent& event);
};

ButtonFrame::ButtonFrame(const wxString& title)
    : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200))
{
    wxPanel* panel = new wxPanel(this,wxID_ANY);
    wxButton* button = new wxButton(panel, wxID_ANY, "Click Me!", wxPoint(100, 60));
    wxButton* btnClose = new wxButton(panel, wxID_ANY, "Close", wxPoint(100, 120));

    button->Bind(wxEVT_BUTTON, &ButtonFrame::OnButtonClick, this);
    btnClose->Bind(wxEVT_BUTTON, &ButtonFrame::onClose, this);
    button->SetFocus();
    Centre();
}

void ButtonFrame::OnButtonClick(wxCommandEvent& event)
{
    wxMessageBox("Button clicked!");
}

void ButtonFrame::onClose(wxCommandEvent& event)
{
    Close();
}

class ButtonApp : public wxApp
{
public:
    virtual bool OnInit();
};

bool ButtonApp::OnInit()
{
    ButtonFrame* frame = new ButtonFrame("Button Example");
    frame->Show(true);
    return true;
}

IMPLEMENT_APP(ButtonApp)
